<div id="sidebar" class="sidebar responsive">

    <div class="sidebar-shortcuts" id="sidebar-shortcuts">
        <div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
            <button class="btn btn-success">
                <i class="ace-icon fa fa-signal"></i>
            </button>

            <button class="btn btn-info">
                <i class="ace-icon fa fa-pencil"></i>
            </button>

            <!-- #section:basics/sidebar.layout.shortcuts -->
            <button class="btn btn-warning">
                <i class="ace-icon fa fa-users"></i>
            </button>

            <button class="btn btn-danger">
                <i class="ace-icon fa fa-cogs"></i>
            </button>

            <!-- /section:basics/sidebar.layout.shortcuts -->
        </div>

        <div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
            <span class="btn btn-success"></span>

            <span class="btn btn-info"></span>

            <span class="btn btn-warning"></span>

            <span class="btn btn-danger"></span>
        </div>
    </div><!-- /.sidebar-shortcuts -->

    <ul class="nav nav-list">
        <php>
            use Common\Controller\AuthController;
            use Think\Auth;
            $m = M('auth_rule');
            $field = 'id,name,title,css';
            $data = $m->field($field)->where('pid=0 AND status=1')->order('sort,id')->select();	   
            $auth = new Auth();
            //没有权限的菜单不显示
            foreach ($data as $k=>$v){
            if(!$auth->check($v['name'], cookie('aid')) && cookie('aid') != 1){
            unset($data[$k]);
            }
            }

        </php>

        <foreach name="data" item="v">
            <li class="<if condition="CONTROLLER_NAME eq $v['name']">active open</if>"><!--open代表打开状态-->
                <a href="#" class="dropdown-toggle">
                    <i class="menu-icon fa {$v.css}"></i>
                    <span class="menu-text">
                        {$v.title}
                    </span>

                    <b class="arrow fa fa-angle-down"></b>
                </a>

                <b class="arrow"></b>

                <ul class="submenu">
                    <php>
                        $m = M('auth_rule');
                        $dataa = $m->where(array('pid'=>$v['id'],'status'=>1))->order('sort')->select();
                        foreach ($dataa as $kk=>$vv){
                        if(!$auth->check($vv['name'], cookie('aid')) && cookie('aid') != 1){
                        unset($dataa[$kk]);
                        }
                        }
                    </php>
                    <foreach name="dataa" item="j">



                        <li class="<if condition="($_COOKIE['s'] eq $j['id'])">active</if>">
                            <a href="{:U($j['name'])}">
                                <i class="menu-icon fa fa-caret-right"></i>
                                {$j.title}
                            </a>
                            <b class="arrow"></b>
                        </li>


                    </foreach>
<!--

                    <if condition="$v['id'] eq 1">

                        <li class="">
                            <a href="{:U('admin_rule')}">
                                <i class="menu-icon fa fa-caret-right"></i>
                                导航设置
                            </a>
                            <b class="arrow"></b>
                        </li>

                    </if>-->


                </ul>
            </li>
        </foreach>

    </ul><!-- /.nav-list -->

    <!-- #section:basics/sidebar.layout.minimize -->
    <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
        <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
    </div>

    <!-- /section:basics/sidebar.layout.minimize -->
    <script type="text/javascript">
        try {
            ace.settings.check('sidebar', 'collapsed')
        } catch (e) {
        }
    </script>
</div>
